from socket import *

host = "127.0.0.1"
port = 8888

server = socket(AF_INET, SOCK_STREAM)
server.bind((host, port))
server.listen(24) # max pooling size

latest_version = "1.3.0"

while True:

    client, addr = server.accept()
    
    ver = client.recv(1024).decode().strip()
    print(f"...{addr} connected with version {ver}")
    
    client.send(latest_version.encode())
    
    if ver != latest_version:
        f = open("app.asar", 'rb')
        data = f.read()
        f.close()
    
        client.send(data)
    
    client.close()
